<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>来养鸭</title>
    <style>
        *{margin: 0;padding: 0}
        html body{
            height: 100%;
        }
        .bg{
            width: 100%;
            height: 100%;
            position: absolute;
            z-index: 1;
            background:url('game_share/bg2172.png?v=20201217');
            background-size:cover !important;
        }
        .bth{
            position: absolute;
            z-index: 2;
            bottom:17%;
            left: 5%;
            text-align: center;
            width: 40%;
        }
        .bth2{
            position: absolute;
            z-index: 2;
            bottom:17%;
            right:5%;
            text-align: center;
            width: 40%;
        }
        img{
            width: 100%;
        }
        .wx{
            display: none;
            position: absolute;
            top: 0%;
            bottom: 0%;
            left: 0%;
            width: 100%;
            height: 100%;
            padding: 0px;
            border: 0px solid #000000; /*orange*/
            background-color: #000000; /*white*/
            z-index:1002;
            overflow: auto;
            user-select: auto;
        }
    </style>
</head>

<body>
<div class="wx">
    <img src="game_share/bg2.png" alt="">
</div>
<div class="browser">
    <div class="bg">
        <!--        <img src="game_share/bg750.png?v=20201217" alt="">-->
    </div>
    <div class="bth">
        <img src="game_share/open.png?v=20201217" alt="" id="open">
    </div>
    <div class="bth2">
        <img src="game_share/download.png?v=20201217" alt="" id="download">
    </div>
</div>


</body>


<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
<script>
    (function() {
        //获取屏幕高度
        var mobileHeight = document.documentElement.clientHeight;
        if (mobileHeight > 480 && mobileHeight < 812){
            $('.bth,.bth2').css('bottom','12%');
        }else if (mobileHeight > 812 && mobileHeight < 1625){
            $('.bth,.bth2').css('bottom','17%');
        }else if (mobileHeight > 1625 && mobileHeight > 2436){
            $('.bth,.bth2').css('bottom','17%');
        }

        var ody = navigator.userAgent.indexOf('ody');
        if (ody > -1){
            location.href = "https://api.laiyifen.com/duckery/web/game/index.html";
            return;
        }

        var config = {
            scheme_IOS: 'lyf://h5?body={"url":"https://api.laiyifen.com/duckery/web/game/index.html"}',
            scheme_Adr: 'lyf://h5?body={"url":"https://api.laiyifen.com/duckery/web/game/index.html"}',
            timeout: 600
        };

        //wx环境
        //if(ua.match(/MicroMessenger/i) == 'micromessenger' || ua.match(/_SQ_/i) == '_sq_'){
        //  $('.wx').css('display','block');
        // $('.browser').css('display','none');
        //}

        function openclient(type) {
            var ua = window.navigator.userAgent.toLowerCase();
            var starttime = Date.now();

            var t = setTimeout(function() {
                var endtime = Date.now();
                if((endtime - starttime) < (config.timeout + 200)) {
                    if (type == 1){
                        if(ua.match(/MicroMessenger/i) == 'micromessenger' || ua.match(/_SQ_/i) == '_sq_'){
                            //alert('请在浏览器打开');
                            $('.wx').css('display','block');
                            $('.browser').css('display','none');
                        }else{
                            location.href = 'lyf://h5?body=' + encodeURI('{"url":"https://api.laiyifen.com/duckery/web/game/index.html"}');
                        }
                    }else if (type == 2){
                        var u = navigator.userAgent;
                        var isAndroid = u.indexOf('android') > -1 || u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
                        var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
                        if (isAndroid) {
                            if (ua.match(/MicroMessenger/i) == 'micromessenger' || ua.match(/_SQ_/i) == '_sq_') {
                                window.setTimeout(function () {
                                    //腾讯应用市场
                                    location.href = "https://a.app.qq.com/o/simple.jsp?pkgname=com.umaman.laiyifen"
                                }, 100)
                            } else {
                                location.href = "market://details?id=com.umaman.laiyifen"
                                window.setTimeout(function () {
                                    //腾讯应用市场
                                    location.href = "https://a.app.qq.com/o/simple.jsp?pkgname=com.umaman.laiyifen"
                                }, 100)
                            }
                        } else if (isiOS) {
                            location.href = "https://apps.apple.com/cn/app/id434205156"
                        }
                    }
                } else {
                    window.close();
                }
            }, config.timeout);

            window.onblur = function() {
                clearTimeout(t);
            }


        }

        window.addEventListener("DOMContentLoaded", function() {
            document.getElementById('open').addEventListener('click', function () {
                openclient(1)
            }, true);
            document.getElementById('download').addEventListener('click', function () {
                openclient(2)
            }, true);
        }, true);
    })();

</script>
